#!/bin/bash

rm -f /tmp/locked.png

# If `imagemagick` is not installed, use a blank screen.
[[ -f /usr/bin/convert ]] &&
    scrot -m -z /tmp/base.png &&
    pgrep -x dunst && notify-send -i ~/.scripts/lock.png "Locking computer..." &&
    convert /tmp/base.png -blur 0x8 /tmp/locked.png

convert -composite /tmp/locked.png "${HOME}/.scripts/resources/rick.png" -gravity Southwest -geometry +250+0  /tmp/locked.png

convert -composite /tmp/locked.png "${HOME}/.scripts/resources/rick2.png" -gravity Southeast -geometry +450+0 /tmp/locked.png




convert /tmp/screen_locked.png -scale 10% -scale 1000% /tmp/screen_locked2.png

# Pause music (mocp, mpd and send the pause key to all mpv videos):
# mocp -P &>/dev/null
# mpc pause &>/dev/null
# pauseallmpv &>/dev/null

i3lock -e -f -c 000000 -i /tmp/locked.png

# # In five seconds, turn off display unless key press in last 4 seconds.
# # sleep 5 && [[ 4000 -lt $(xssstate -i) ]] &&  wpgrep -x i3lock && xset dpms force off
sleep 10 && xset dpms force off
